package com.check.checksamejourney.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

public class WxappUtil {

    private static String appid = "wxffae68487065a898";

    private static String secret = "";

    private static String token = "";

    private static String aesKey = "";

    public static String getOpenId (String jsCode){
        String url = "https://api.weixin.qq.com/sns/jscode2session?" +
                "appid=" + appid +
                "&secret=" + secret +
                "&js_code=" + jsCode +
                "&grant_type=authorization_code";
        String response = OkHttpUtil.getRequest(url);
        String openId = null;
        if (response!=null){
            JSONObject responseJson = JSON.parseObject(response);
            openId = responseJson.getString("openid");
        }
        return openId;
    }

    public static String getToken(){
        return null;
    }

    public static String sendSubscriptionMsg(){
        return null;
    }

}
